<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>用户管理</title>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" href="./css/x-admin.css" media="all" />
    <style type="text/css">
        .open{
            border:1px solid #ccc;
            padding: 0 3px 0 3px;
            cursor: pointer;
        }
    </style>
    
</head>
<body>
<div class="x-nav">
    <span class="layui-breadcrumb"> <a><cite>首页</cite></a> <a><cite>用户管理</cite></a> <a><cite>用户列表</cite></a> </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <button class="layui-btn" ><a href="user-add.jsp"><font color="white"><i class="layui-icon">&#xe608;</i>添加</font></a></button>
        <span class="x-right" style="line-height:40px">共有数据：<span class="layui-badge">${usercount}</span> 条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr pid="0">
            <th> ID </th>
            <th> 用户名 </th>
            <th> 密码 </th>
            <th> 真实姓名 </th>
            <th> 电话号码 </th>
            <th> 地址 </th>
            <th> 操作</th>
        </tr>
        </thead>
        <tbody id="x-img">
		<c:forEach items="${userlist }" var="user" varStatus="status">
        <tr id="1" pid="0">
            <td>${status.index+1 }</td><!--存放ID-->
            <td>${user.username }</td><!--存放同户名-->
            <td>${user.pwd }</td><!--存放密码-->
            <td>${user.realname }</td><!--存放姓名-->
            <td>${user.phone }</td><!--存放电话-->
            <td>${user.address }</td><!--存放地址-->
            <td class="td-manage">
                <a title="编辑" href="javascript:;" onclick="cate_edit('编辑','useredt.do','${user.id }')" class="ml-5" style="text-decoration:none"> <i class="layui-icon"></i> </a>
                <a title="删除" href="javascript:;" onclick="cate_del(this,'${user.id }')" style="text-decoration:none"> <i class="layui-icon"></i> </a>
            </td>
        </tr>
		</c:forEach>
        </tbody>
    </table>
    <div id="page"></div>
</div>
<script src="./lib/layui/layui.js" charset="utf-8"></script>
<script src="./js/x-layui.js" charset="utf-8"></script>
<script src="./js/jquery.min.js" charset="utf-8"></script>
<script>
    layui.use(['laydate','element','laypage','layer'], function(){
        $ = layui.jquery;//jquery
        laydate = layui.laydate;//日期插件
        lement = layui.element();//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层

        //以上模块根据需要引入

        layer.ready(function(){ //为了layer.ext.js加载完毕再执行
            layer.photos({
                photos: '#x-img'
                //,shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
            });
        });

    });
    /*添加*/
    function banner_add(title,url,w,h){
        x_admin_show(title,url,w,h);
    }
    function adds(title,url,id,w,h){
        url=url+"?id="+id;
        x_admin_show(title,url,w,h);
    }
    // 编辑
    function cate_edit (title,url,id) {
        url=url+"?id="+id;
        x_admin_show(title,url);
    }
    /*删除*/
    function cate_del(obj,id){
        layer.confirm('确认要删除吗？',{icon:3,title:'提示信息'},function(index){
          	$(obj).parents("tr").remove();
          	layer.msg('删除成功！',{icon:1,time:1000});
          	setInterval(function () {
          		window.location.href="userdel.do?id="+id;
			}, 500);
        });
    }

</script>
</body>
</html>